package com.wcy.feign.user;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wcy.entity.UserRating;
import com.wcy.entity.result.RatingResult;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "cloud-provider-user", contextId = "FeignUserRatingService")
public interface FeignUserRatingService {
    @GetMapping("userRating/page")
    public ResponseEntity<Page<UserRating>> getPage(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
                                                    @RequestParam(name = "pageSize",defaultValue = "10") int pageSize);
    @GetMapping("userRating/list")
    public ResponseEntity<List<UserRating>> getList();
    @PostMapping("userRating/add")
    public ResponseEntity<Void> add(@RequestBody UserRating userRating);
    @PutMapping("userRating/update")
    public ResponseEntity<Void> update(@RequestBody UserRating userRating);
    @DeleteMapping("userRating/delete/{id}")
    public ResponseEntity<Void> delete(@PathVariable("id") Integer id);

    @GetMapping("userRating/resource/{id}")
    ResponseEntity<RatingResult> getByResourceId(@PathVariable("id") Integer id);

    @GetMapping("userRating/resource/{id}/hasRated")
    ResponseEntity<Boolean> getHasRated(@PathVariable("id") Integer id);

    @PostMapping("userRating/resource/{id}/send")
    ResponseEntity<Boolean> sendRating(@PathVariable("id") Integer id,@RequestBody UserRating rating);
}
